﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace Arnej.FriendFeed.Api
{
    [XmlRoot(ElementName = "feed")]
    public class Feed
    {
        [XmlElement(ElementName = "entry")]
        public List<Entry> Entries { get; set; }
    }

    [XmlType(TypeName = "entry")]
    public class Entry
    {
        [XmlElement(ElementName = "id")]
        public Guid Id { get; set; }

        [XmlElement(ElementName = "title")]
        public string Title { get; set; }

        [XmlElement(ElementName = "link")]
        public String Link { get; set; }

        [XmlElement(ElementName = "published")]
        public DateTime Published { get; set; }

        [XmlElement(ElementName = "updated")]
        public DateTime Updated { get; set; }

        [XmlElement(ElementName = "hidden")]
        public string Hidden { get; set; }

        [XmlElement(ElementName = "user")]
        public User User { get; set; }

        [XmlElement(ElementName = "service")]
        public Service Service { get; set; }

        [XmlElement(ElementName = "comment")]
        public List<Comment> Comments { get; set; }

        [XmlElement(ElementName = "like")]
        public List<Like> Likes { get; set; }

        [XmlElement(ElementName = "media")]
        public List<Media> Media { get; set; }

        [XmlElement(ElementName = "via")]
        public Via Via { get; set; }

        [XmlElement(ElementName = "room")]
        public Room Room { get; set; }
    }

    [XmlType(TypeName = "comment")]
    public class Comment
    {
        [XmlElement(ElementName = "date")]
        public DateTime Date { get; set; }

        [XmlElement(ElementName = "user")]
        public User User { get; set; }

        [XmlElement(ElementName = "body")]
        public string Body { get; set; }

        [XmlElement(ElementName = "via")]
        public Via Via { get; set; }
    }

    [XmlType(TypeName = "user")]
    public class User
    {
        [XmlIgnore]
        public static User Everyone
        {
            get
            {
                return new User()
                {
                    Nickname = "everyone"
                };
            }
        }

        [XmlElement(ElementName = "id")]
        public Guid Id { get; set; }

        [XmlElement(ElementName = "name")]
        public string Name { get; set; }

        [XmlElement(ElementName = "nickname")]
        public string Nickname { get; set; }

        [XmlElement(ElementName = "profileUrl")]
        public String ProfileUri { get; set; }

        [XmlElement(ElementName = "subscription")]
        public List<User> Subscriptions { get; set; }

        [XmlElement(ElementName = "service")]
        public List<Service> Services { get; set; }

        [XmlElement(ElementName = "room")]
        public List<Room> Rooms { get; set; }
    }

    [XmlType(TypeName = "content")]
    public class Content
    {
        [XmlElement(ElementName = "url")]
        public string Url { get; set; }

        [XmlElement(ElementName = "type")]
        public string MimeType { get; set; }

        [XmlElement(ElementName = "width")]
        public int Width { get; set; }

        [XmlElement(ElementName = "height")]
        public int Height { get; set; }
    }

    [XmlType(TypeName = "like")]
    public class Like
    {
        [XmlElement(ElementName = "date")]
        public DateTime Date { get; set; }

        [XmlElement(ElementName = "user")]
        public User User { get; set; }
    }

    [XmlType(TypeName = "service")]
    public class Service
    {
        [XmlElement(ElementName = "id")]
        public string Id { get; set; }

        [XmlElement(ElementName = "name")]
        public string Name { get; set; }

        [XmlElement(ElementName = "iconUrl")]
        public String IconUrl { get; set; }

        [XmlElement(ElementName = "profileUrl")]
        public String ProfileUrl { get; set; }
    }

    [XmlType(TypeName = "via")]
    public class Via
    {
        [XmlElement(ElementName = "name")]
        public string Name { get; set; }

        [XmlElement(ElementName = "url")]
        public String Url { get; set; }
    }

    [XmlType(TypeName = "room")]
    public class Room
    {
        [XmlElement(ElementName = "id")]
        public Guid Id { get; set; }

        [XmlElement(ElementName = "name")]
        public string Name { get; set; }

        [XmlElement(ElementName = "nickname")]
        public string Nickname { get; set; }

        [XmlElement(ElementName = "Name")]
        public String Url { get; set; }
    }

    [XmlType(TypeName = "media")]
    public class Media
    {
        [XmlElement(ElementName = "title")]
        public string Title { get; set; }

        [XmlElement(ElementName = "player")]
        public string Player { get; set; }

        [XmlElement(ElementName = "thumbnail")]
        public List<Thumbnail> Thumbnails { get; set; }

        [XmlElement(ElementName = "content")]
        public List<Content> Contents { get; set; }
    }

    [XmlType(TypeName = "thumbnail")]
    public class Thumbnail
    {
        [XmlElement(ElementName = "url")]
        public String Url { get; set; }

        [XmlElement(ElementName = "width")]
        public int Width { get; set; }

        [XmlElement(ElementName = "height")]
        public int Height { get; set; }
    }

    [XmlType(TypeName = "profiles")]
    public class Profiles
    {
        [XmlElement(ElementName = "profile")]
        public List<User> ProfilesList { get; set; }
    }
}